/**
O * Alipay.com Inc.
 * Copyright (c) 2004-2020 All Rights Reserved.
 */
package learning.java.web.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import learning.java.web.dao.UserDao;
import learning.java.web.entity.User;

/**
 * 首页
 * 
 * @author Rayliu40k
 * @version $Id: IndexController.java, v 0.1 Oct 30, 2020 3:15:30 PM Rayliu40k Exp $
 */
@Controller
public class IndexController {

    @Autowired
    private UserDao userDao;

    /**
     * modifyPassword
     */
    @RequestMapping("/modifyPassword")
    public String modifyPassword(String name) {
        System.out.println(name);
        return "modifyPassword";
    }

    /**
     * txt
     */
    @RequestMapping("/txt")
    public String txt(String name) {
        System.out.println(name);
        return "txt";
    }

    @RequestMapping("/search")
    public String search(Model model) {
        List<User> users = this.userDao.search();
        model.addAttribute("users", users);
        return "search";
    }
    
    @RequestMapping("/dojiefeng")
    public String dosearch(Model model,String username) {
        this.userDao.jiefeng(username);
        return "search";
    }
    
    /**
     * 根页面
     */
    @RequestMapping("/")
    public String root() {
        return "index";
    }

    /**
     * 首页
     */
    @RequestMapping("/index")
    public String index(Model model) {
        
        return "index";
    }

    /**
     * 首页
     */
    @RequestMapping("/home")
    public String home(String username, Model model) {
        model.addAttribute("username", username);
        return "home";
    }

    /**
     * 首页
     */
    @RequestMapping("/register")
    public String home() {
        return "register";
    }

}
